<%@ page contentType="text/html;charset=UTF-8" %>
<%@ include file="/WEB-INF/views/include/taglib.jsp" %>
<html>
<head>
    <title>订单管理</title>
    <meta name="decorator" content="default"/>
    <script type="text/javascript">
        function page(n, s) {
            $("#pageNo").val(n);
            $("#pageSize").val(s);
            var channels=$("#channel").val();
            $("#searchForm").attr("action", "${ctx}/sys/shoppingOrderProduct/showShoppingOrder/"+channels);
            $("#searchForm").submit();
            return false;
        }
    </script>
</head>
<body>
<ul class="nav nav-tabs">
    <li class="active"><a href="${ctx}/sys/shoppingOrderProduct/showShoppingOrder/${channel}">订单管理</a></li>
</ul>
<form:form id="searchForm" modelAttribute="tbOrder" action="${ctx}/sys/shoppingOrderProduct/showShoppingOrder/${channel}"
           method="post" class="breadcrumb form-search">
    <input id="channel" type="hidden" value="${channel}"/>
    <input id="pageNo" name="pageNo" type="hidden" value="${page.pageNo}"/>
    <input id="pageSize" name="pageSize" type="hidden" value="${page.pageSize}"/>
    <label>联系人：</label><form:input path="contactName" htmlEscape="false" maxlength="50" class="input-medium"/>
    <label>日期范围：&nbsp;</label>
    <input id="beginDate" name="beginDate" type="text" readonly="readonly" maxlength="20"
           class="input-mini Wdate" value="<fmt:formatDate value="${tbOrder.beginDate}" pattern="yyyy-MM-dd"/>" onclick="WdatePicker({dateFmt:'yyyy-MM-dd',isShowClear:false});"/>
    --&nbsp;<input id="endDate" name="endDate" type="text" readonly="readonly" maxlength="20" class="input-mini Wdate"
    value="<fmt:formatDate value="${tbOrder.endDate}" pattern="yyyy-MM-dd"/>" onclick="WdatePicker({dateFmt:'yyyy-MM-dd',isShowClear:false});"/>&nbsp;&nbsp;
    &nbsp;
    <c:if test="${bianli==1}">
        <li>
            <label>配送时间:</label>

                    <input type="text" readonly="readonly" class="input-mini Wdate" name="startTime" value="${tbOrder.startTime == null ? '08:00':tbOrder.startTime}" required
                           onclick="WdatePicker({dateFmt:'HH:mm',isShowClear:false});"
                    />
                    <input type="text" readonly="readonly" class="input-mini Wdate" name="endTime" value="${tbOrder.endTime == null ? '18:00' : tbOrder.endTime}" required
                           onclick="WdatePicker({dateFmt:'HH:mm',isShowClear:false});"
                    />



        </li>
    </c:if>
    <input id="btnSubmit" class="btn btn-primary" type="submit" value="查询"/>
</form:form>
<sys:message content="${message}"/>
<span><font style="color: #00A6C7">${message1}</font></span>
<table id="contentTable" class="table table-striped table-bordered table-condensed">
    <thead>
    <tr>
        <th>订单号</th>
        <th>订单状态</th>
        <th>订单时间</th>
        <c:if test="${bianli==1}">
            <th>送货时间</th>
        </c:if>
        <th>配送费</th>
        <th>订单总额</th>
        <th>联系人</th>
        <th>联系电话</th>
        <th>买家留言</th>
        <th>送货地址</th>
        <th>操作</th>
    </tr>
    </thead>
    <tbody>
    <c:forEach items="${userGardenStuffPage.list}" var="tbOrder">
        <tr>
            <td>${tbOrder.orderNo}</td>
            <td>
                <c:if test="${tbOrder.orderState eq '0'}">
                    未确认（未支付）
                </c:if>
                <c:if test="${tbOrder.orderState eq '1'}">
                    已确认(已支付)
                </c:if>
                <c:if test="${tbOrder.orderState eq '2'}">
                    待发货
                </c:if>
                <c:if test="${tbOrder.orderState eq '3'}">
                    已发货
                </c:if>
                <c:if test="${tbOrder.orderState eq '4'}">
                    已完成
                </c:if>
                <c:if test="${tbOrder.orderState eq '5'}">
                    已取消
                </c:if>
                <c:if test="${tbOrder.orderState eq '6'}">
                    已关闭
                </c:if>
            </td>
            <td><fmt:formatDate value="${tbOrder.orderTime}" type="both" pattern="yyyy-MM-dd HH:mm:ss"/></td>
            <c:if test="${bianli==1}">
                <td>${tbOrder.extraParam}</td>
            </c:if>
            <td>${tbOrder.packageFee}</td>
            <td>${tbOrder.orderAmount}</td>
            <td>${tbOrder.contactName}</td>
            <td>${tbOrder.contactMobile}</td>
            <td>${tbOrder.orderSubject}</td>
            <td>${tbOrder.address}</td>
            <td>
                <c:choose>
                  <c:when test="${tbOrder.orderState eq '1'}">
                      <c:if test="${channel==3}">
                          <a href="${ctx}/sys/shoppingOrderProduct/reserveUserShoppingOrderU/${tbOrder.id}">确认发货</a>
                      </c:if>
                      <c:if test="${channel==4}">
                          <a href="${ctx}/sys/shoppingOrderProduct/reserveUserShoppingOrderU/${tbOrder.id}">确认发货</a>
                      </c:if>
                      <c:if test="${channel==2}">
                          <a href="${ctx}/sys/shoppingOrderProduct/reserveUserShoppingOrderU/${tbOrder.id}">确认发货</a>
                      </c:if>
                    </c:when>
                    <c:when test="${tbOrder.orderState eq '2'}">
                        <c:if test="${channel==3}">
                            <a href="${ctx}/sys/shoppingOrderProduct/reserveUserShoppingOrderU/${tbOrder.id}">确认发货</a>
                        </c:if>
                        <c:if test="${channel==4}">
                            <a href="${ctx}/sys/shoppingOrderProduct/reserveUserShoppingOrderU/${tbOrder.id}">确认发货</a>
                        </c:if>
                        <c:if test="${channel==2}">
                            <a href="${ctx}/sys/shoppingOrderProduct/reserveUserShoppingOrderU/${tbOrder.id}">确认发货</a>
                        </c:if>
                    </c:when>
                    <c:otherwise>
                        <c:if test="${channel==3}">
                            <a href="${ctx}/sys/shoppingOrderProduct/reserveUserShoppingOrderU/${tbOrder.id}">查看明细</a>
                        </c:if>
                        <c:if test="${channel==4}">
                            <a href="${ctx}/sys/shoppingOrderProduct/reserveUserShoppingOrderU/${tbOrder.id}">查看明细</a>
                        </c:if>
                        <c:if test="${channel==2}">
                            <a href="${ctx}/sys/shoppingOrderProduct/reserveUserShoppingOrderU/${tbOrder.id}">查看明细</a>
                        </c:if>
                    </c:otherwise>
                </c:choose>
            </td>
        </tr>
    </c:forEach>
    </tbody>
</table>
<div class="pagination">${userGardenStuffPage}</div>
</body>
</html>
